package com.fresh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.fresh.entity.RawIn;
import com.fresh.entity.RawInQO;
import com.fresh.mapper.YuanLiaoMapper;
import com.fresh.service.YuanLiaoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YuanLiaoServiceImpl implements YuanLiaoService {
    @Autowired
    YuanLiaoMapper yuanLiaoMapper;

    @Override
    public PageInfo<RawIn> findPageInfoByCondition(RawInQO rawInQO, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<RawIn> rowIns = yuanLiaoMapper.findPageInfoByCondition(rawInQO);
        PageInfo<RawIn> pageInfo = new PageInfo<>(rowIns);
        return pageInfo;
    }

    @Override
    public void add(RawIn rawIn) {
        yuanLiaoMapper.insert(rawIn);
    }

    @Override
    public void update(RawIn rawIn) {
        yuanLiaoMapper.update(rawIn);
    }

    @Override
    public void changeStatus3ByCgNo(String cgNo,String data) {
        yuanLiaoMapper.updateStatus3ByCgNo(cgNo,data);
    }

    @Override
    public void changeStatus4ByCgNo(String cgNo,String data) {
        yuanLiaoMapper.updateStatus4ByCgNo(cgNo,data);
    }

    @Override
    public Integer getRiNum(String cgNo) {
        return yuanLiaoMapper.getRiNum(cgNo);
    }

    @Override
    public void updateRiNum(String cgNo, Integer roNum) {
        yuanLiaoMapper.updateRiNum(cgNo, roNum);
    }

}
